From 4a85f437cfa7a61bebd341c9a509abccbd64745b Mon Sep 17 00:00:00 2001
From: Mqdd <ahmadmiqdad27@gmail.com>
Date: Wed, 18 Feb 2026 17:26:59 +0700
Subject: <MIqdad> fix pagination

---
 src/pages/searchkey/[slug].jsx | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

(limited to 'src/pages/searchkey/[slug].jsx')

diff --git a/src/pages/searchkey/[slug].jsx b/src/pages/searchkey/[slug].jsx
index b0fc9ab8..2fa3cf8d 100644
--- a/src/pages/searchkey/[slug].jsx
+++ b/src/pages/searchkey/[slug].jsx
@@ -8,11 +8,11 @@ import { capitalizeEachWord } from '../../utils/capializeFIrstWord';
 // ✅ Breadcrumb = default export
 import Breadcrumb from '@/lib/category/components/Breadcrumb';
 
-const BasicLayout = dynamic(() =>
-  import('@/core/components/layouts/BasicLayout')
+const BasicLayout = dynamic(
+  () => import('@/core/components/layouts/BasicLayout'),
 );
-const ProductSearch = dynamic(() =>
-  import('@/lib/product/components/ProductSearch')
+const ProductSearch = dynamic(
+  () => import('@/lib/product/components/ProductSearch'),
 );
 
 export default function KeywordPage() {
@@ -33,7 +33,7 @@ export default function KeywordPage() {
   const getSearchKeyData = async (slug) => {
     try {
       const res = await axios(
-        `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/searchkey?url=${slug}&from=searchkey`
+        `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/searchkey?url=${slug}&from=searchkey`,
       );
 
       setResult(res?.data?.response?.docs?.[0] || null);
@@ -52,7 +52,7 @@ export default function KeywordPage() {
   useEffect(() => {
     if (!result) return;
 
-    // product search
+    // product search - keep ids for API, add from marker for ProductSearch
     const ids = result.product_ids_is || [];
     setQuery({
       ids: ids.join(','),
@@ -90,7 +90,9 @@ export default function KeywordPage() {
       )}
 
       {/* ✅ Product result */}
-      {query && <ProductSearch query={query} prefixUrl={route.asPath} />}
+      {query && (
+        <ProductSearch query={query} prefixUrl={`/searchkey/${slugRaw}`} />
+      )}
     </BasicLayout>
   );
 }
-- 
cgit v1.2.3

